//-------------------------------------------------------------------
//	Copyright (c) 2010-2012  Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_MATERIAL_H
#define _UX_MATERIAL_H

#include "IMaterial.h"

namespace Engine
{
namespace Resources
{
	
	//
	// Material
	//

	class _EXPORT_ CMaterial : public IMaterial
	{
	protected:
		mtrlayer_array_t		_aLayers;
		e_render_layer::bits	_eLayer;
		uint					_uMaxLOD;

	public:
		CMaterial();
		~CMaterial();

		bool Create(/*TODO*/);
		bool AddLayer(IMaterialLayer *pLayer);


		// IMaterial //
		virtual bool IsExist(e_render_layer::type eLayer, uint uLOD);
		virtual bool GetLayer(IMaterialLayer *&pLayer, e_render_layer::type eLayer, uint uLOD);
		virtual void GetUniqueLayers(mtrlayer_uni_array_t &aLayers);
		virtual e_render_layer::bits GetLayerBits()		const	{ return _eLayer; }	


		// IResource //
		virtual bool				SwapData(const IResourcePtr &);
		virtual void				Destroy();
		virtual bool				IsValid()	const	{ return !_aLayers.Empty(); }
		virtual e_resource::type	GetType()	const	{ return e_resource::MATERIAL; }


		//static IMaterialLayer * s_CreateLayer(e_mtr_layer::type eType);
	};

//-------------------------------------------------------------------

}	// Resources
}	// Engine

#endif	// _UX_MATERIAL_H